<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>微信-VIP充值</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <style type="text/css">
    .layui-form-label {padding: 9px 4px;width: 50px;}
    .layui-input-block { margin-left: 10px;min-height: 36px; padding: 2px 5px;}
    ul{}
    ul li{ padding: 5px 10px;margin-top: 10px; background: rgba(255,255,255,1);border-radius: 4px;border: 1px solid rgba(42,203,144,1);color: #222;}
    ul li.select{border: 1px solid #F40; color: #F40}
    #save{border: 1px solid rgba(42,203,144,1);background: #FFF; color: #333;}
    div.zs{ background-image: url("/images/zs.png");background-repeat: no-repeat;    background-repeat: no-repeat;position: absolute;padding: 1px 5px;font-size: 12px;color: #fff;width: 70px;height: 30px;right: 10%;z-index: 10;margin-top: -40px;}
    #black_bg{ background:#000; position:fixed; left:0; top:0; right:0; bottom:0; opacity:0.5; display:none; z-index:1}
#iphone_info{ width:100%; height:100px; background:url(/arrow.png) no-repeat 90% 10%; position:fixed; top:0; background-size:65px 64px; text-align:center; font:bold 18px/28px "STHeitiSC-Light","Microsoft YaHei"; color:#fff; padding-top:70px; text-shadow:0 0 4px #000; display:none; z-index:2}
#iphone_info span{ color:#f80}
#android_info{ width:100%; height:100px; background:url(/arrow.png) no-repeat 90% 10%; position:fixed; top:0; background-size:65px 64px; text-align:center; font:bold 18px/28px "STHeitiSC-Light","Microsoft YaHei"; color:#fff; padding-top:70px; text-shadow:0 0 4px #000; display:none; z-index:2}
#android_info span{ color:#f80}
    </style>
</head>
<body>
<div class="layui-form"  style="padding-top:60px;">
  <div class="layui-form-item layui-form-text">
<!--     <label class="layui-form-label">账号</label> -->
    <div class="layui-input-block">
      <input name="user_name" id="user_name" class="layui-input layui-text" value="${user_name?default('')}" placeholder="51度注册手机 或ID"/>
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
<!--     <label class="layui-form-label">套餐</label> -->
    <div class="layui-input-block">
       <ul>
    		<#list package_list as one>
    		<li package_id="${one.id}">${one.title}<#if one.zs_hot gt 0> <div class="zs">送${one.zs_hot}℃</div></#if> ${one.price}元</li>
    		</#list>
    	</ul>
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label"></label>
    <div class="layui-input-block">
      <a class="layui-btn layui-btn-norma" id="save" ><img alt="" src="/images/weixin.png" style="width: 18px;height: 18px;margin-right: 10px;">立即充值</a>
    </div>
  </div>
</div>

<div id="black_bg"></div>
<div id="iphone_info">请点击<span>右上角</span>按钮<br />选择"<span>在Safari中打开</span>"</div>
<div id="android_info">请点击<span>右上角</span>按钮<br />选择"<span>在浏览器中打开</span>"</div>
</body>

<script src="/js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="/layui/layui.all.js"></script>
<script type="text/javascript">

function iphone_weixn(){
    var ua = navigator.userAgent.toLowerCase();
    if(ua.match(/MicroMessenger/i)=="micromessenger" && (ua.match(/iphone/i) == "iphone" || ua.match(/ipad/i) == "ipad")) {
        return true;
    } else {
        return false;
    }
}

function android_weixn(){
    var ua = navigator.userAgent.toLowerCase();
    if(ua.match(/MicroMessenger/i)=="micromessenger" && ua.match(/android/i) == "android") {
        return true;
    } else {
        return false;
    }
}

function iphone()
{
    if(iphone_weixn())
    {
        document.getElementById('iphone_info').style.display = 'block';
        document.getElementById('black_bg').style.display = 'block';
    }
}

function android()
{
    if(android_weixn())
    {
        document.getElementById('android_info').style.display = 'block';
        document.getElementById('black_bg').style.display = 'block';
    }
}


$("ul li").click(function(){
	 $('ul li').removeClass('select');  // 删除其他兄弟元素的样式
    $(this).addClass('select'); 
});
$("#save").click(function(){
	
	if(iphone_weixn()){
	     document.getElementById('iphone_info').style.display = 'block';
   	     document.getElementById('black_bg').style.display = 'block';
	} else if (android_weixn()){
         document.getElementById('android_info').style.display = 'block';
         document.getElementById('black_bg').style.display = 'block';
    } else {
    	if ($("ul li.select").attr("package_id") != undefined){
    		var package_id = $("ul li.select").attr("package_id");
    		var user_name = $("#user_name").val();
    		if(user_name) {

    			window.location.href= "/pay/alipay2?package_id=" +package_id+"&user_name="+user_name;
    		} else {
    			layer.msg("请输入账号!");
    		}
    	} else {
    		layer.msg("请选择套餐!");
    	}
	}
});







</script>
</html>